package mjc.egg;
import mjc.compiler.*;
import mjc.gc.*;
import mg.egg.eggc.compiler.libjava.lex.*;
import mg.egg.eggc.compiler.libjava.messages.*;
import mg.egg.eggc.compiler.libjava.*;
import mg.egg.eggc.compiler.libjava.problem.IProblem;
import java.util.Vector;
public class S_EXTENSION_MJAVA {
LEX_MJAVA scanner;
  S_EXTENSION_MJAVA() {
    }
  S_EXTENSION_MJAVA(LEX_MJAVA scanner) {
    this.scanner = scanner;
    this.att_scanner = scanner;
    }
int [] sync= new int[0];
  TDS att_tdsclasses;
  String att_hnomclasse;
  TDS att_htdsclasses;
  INFOCLASSE att_infoclasse;
  LEX_MJAVA att_scanner;
  private void regle6() throws Exception {

    //declaration
    //appel
      action_ini_6();
  }
  private void regle5() throws Exception {

    //declaration
    T_MJAVA x_2 = new T_MJAVA(scanner ) ;
    T_MJAVA x_3 = new T_MJAVA(scanner ) ;
    //appel
    x_2.analyser(LEX_MJAVA.token_etend);
    x_3.analyser(LEX_MJAVA.token_ident);
      action_valide_5(x_3);
  }
private void action_valide_5(T_MJAVA x_3) throws Exception {
try {
// locales
INFO loc_i;
INFOCLASSE loc_ic;
// instructions
loc_i=this.att_htdsclasses.chercherGlobalement(x_3.att_txt);
if (loc_i==null){
att_scanner._interrompre(IProblem.Semantic, att_scanner.getBeginLine(), IMJAVAMessages.id_MJAVA_unknown_class, MJAVAMessages.MJAVA_unknown_class,new Object[]{""+x_3.att_txt});

}
else {
loc_ic= new INFOCLASSE(this.att_hnomclasse, loc_i);
this.att_infoclasse=loc_ic;
    this.att_htdsclasses.inserer(this.att_hnomclasse, loc_ic);
System.out.print(""+"// "+this.att_hnomclasse+" est une sous-classe de "+x_3.att_txt+"\n");
}
this.att_tdsclasses=this.att_htdsclasses;
}catch(RuntimeException e) {		//e.printStackTrace();
       scanner._interrompre(IProblem.Internal, scanner.getBeginLine(), ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,e.getStackTrace());
	}
  }
private void action_ini_6() throws Exception {
try {
// locales
INFOCLASSE loc_i;
// instructions
loc_i= new INFOCLASSE(this.att_hnomclasse);
this.att_infoclasse=loc_i;
    this.att_htdsclasses.inserer(this.att_hnomclasse, loc_i);
this.att_tdsclasses=this.att_htdsclasses;
}catch(RuntimeException e) {		//e.printStackTrace();
       scanner._interrompre(IProblem.Internal, scanner.getBeginLine(), ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,e.getStackTrace());
	}
  }
  public void analyser () throws Exception {
    scanner.lit ( 1 ) ;
    switch ( scanner.fenetre[0].code ) {
      case LEX_MJAVA.token_etend : // 19930
        regle5 () ;
      break ;
      case LEX_MJAVA.token_aco : // 19915
        regle6 () ;
      break ;
      default :
               scanner._interrompre(IProblem.Syntax, scanner.getBeginLine(), IMJAVAMessages.id_MJAVA_unexpected_token,MJAVAMessages.MJAVA_unexpected_token,new String[]{scanner.fenetre[0].getNom()});
    }
  }
  }
